/**
 * Copyright (c) [2022] [yanyeori]
 * [yanyeori-framework] is licensed under Mulan PSL v2.
 * You can use this software according to the terms and conditions of the Mulan PSL v2.
 * You may obtain a copy of Mulan PSL v2 at: http://license.coscl.org.cn/MulanPSL2
 * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
 * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
 * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
 * See the Mulan PSL v2 for more details.
 */
package com.yanyeori.webtest.config;

import com.yanyeori.framework.web.annotation.RestContext;
import com.yanyeori.webtest.constant.WebConst;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.client.RestTemplate;

/**
 * 创建RestTemplate Bean
 *
 * @author chenkuan
 * @since 2021/7/29 029 16:48
 */
@Configuration
public class RestTemplateConfig {

    @Bean
    @RestContext
    public RestTemplate restTemplate() {
        return new RestTemplate();
    }

    @Bean(name = WebConst.RESTTEMPLATE_LOADBALANCED)
    @LoadBalanced
    @RestContext
    public RestTemplate restTemplateLoadBalanced() {
        return new RestTemplate();
    }
}
